import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import { ElMessage } from "element-plus";
const checkLogin = () =>{
  if(!localStorage.getItem(userInfo)){
    ElMessage({
      message: "请您先登录",
      type: "error",
    })
    return false;
  }
  return true
}
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  }, {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  }, {
    path: '/community',
    name: 'Community',
    component: () => import('../views/Community.vue')
  }, {
    path: '/userCenter',
    name: 'UserCenter',
    component: () => import('../views/UserCenter.vue'),
    
  }, {
    path: '/article',
    name: 'Article',
    component: () => import('../views/Article.vue')
  }, {
    path: '/forgetPassword',
    name: 'ForgetPassword',
    component: () => import('../views/ForgetPassword.vue')
  }, {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue')
  }, {
    path: '/race',
    name: 'Race',
    component: () => import('../views/Race.vue')
  }, {
    path: '/demo',
    name: 'Demo',
    component: () => import('../views/Demo.vue')
  },
  {
    path: '/raceDetail',
    name: 'RaceDetail',
    component: () => import('../views/RaceDetail.vue'),
    children: [{
      path: '/raceDetail',
      name: 'raceDetailRule',
      component: () => import('../views/raceDetail/Rule.vue')
    }, {
      path: '/raceDetail/rank',
      name: 'raceDetailRank',
      component: () => import('../views/raceDetail/Rank.vue')
    }]
  }, {
    path: '/uploadFile',
    name: 'UploadFile',
    component: () => import('../views/UploadFile.vue')
  },{
    path:'/visualization',
    name: 'Visualization',
    component: () => import('../views/Visualization.vue')
  },{
    path:'/deviceInformation',
    name: 'DeviceInformation',
    component: () => import('../views/DeviceInformation.vue')
  },{
    path:'/success',
    name: 'Success',
    component: () => import('../views/Success.vue')
  },{
    path:'/uploadLog',
    name: 'UploadLog',
    component: () => import('../views/UploadLog.vue')
  },{
    path:'/preInformation',
    name: 'preInformation',
    component: () => import('../views/PreInformation.vue')
  }
  
  
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
